package com.haighcom.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.haighcom.entity.PageResult;
import com.haighcom.mapper.SetMealMapper;
import com.haighcom.model.Setmeal;
import com.haighcom.service.SetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SetMealServiceImpl implements SetMealService {
    @Autowired
    private SetMealMapper setMealMapper;
    @Override
    public PageResult queryPage(Integer currentPage, Integer pageSize, String queryString) {
        //开启分页
        PageHelper.startPage(currentPage,pageSize);
        //开启分页以后自动追加查询语句
        Page<Setmeal> page = setMealMapper.selectByCondition(queryString);
        return new PageResult(page.getTotal(),page.getResult());
    }
}
